<?php 
require 'kernel/common.php';
if(!$Session->check_admin()) redirect('index.php');

if(isset($_POST['send_delete']) || isset($_POST['cancel_delete']))
{
	if(isset($_POST['cancel_delete'])) redirect('agence.php');
	
	if(isset($_POST['send_delete']))
	{
		if(!$id = retrieve('POST', 'id', true)) reditect('agence.php?error=no_select_agence');
		$db->sql_query("DELETE FROM immo_agence WHERE id = '". $id ."'");		
		SuccesAffiche($lang['Agence_supprimee'], 'agence.php');
	}
}
else
{
	$id = retrieve('GET', 'id', true);
	$nom = retrieve('GET', 'nom', true);
	$template->set_filenames(array('agence_suppression' => 'template/agence_suppression.tpl'));
	$template->assign_vars(array(
	'V_ID'	=>	$id,
	'V_NOM_AGENCE'	=>	base64_decode($nom),
	'L_CONFIRMER_SUPPRESSION_AGENCE'	=>	$lang['Confirmer_suppression_agence'],
	'L_SUPPRIMER'	=>	$lang['Supprimer'],
	'L_ANNULER'	=>	$lang['Annuler'],
	'L_RETOUR'	=>	$lang['Retour'],
	));
	$template->display('agence_suppression');
    require 'footer.php';
}
?>